:javascript
  var rails_admin_jcrop_options = #{field.jcrop_options.to_json};

= stylesheet_link_tag 'rails_admin/jquery.Jcrop'
= javascript_include_tag 'rails_admin/jquery.Jcrop'
= javascript_include_tag 'rails_admin/ra.jcrop'

- file = form.object.send(field.method_name).presence

.toggle{:style => ('display:none;' if file && field.delete_method && form.object.send(field.delete_method) == '1')}
  - if value = field.pretty_value
    = value
  = form.file_field(field.name, field.html_attributes.reverse_merge({ :data => { :fileupload => true } }))
  = link_to 'Edit Image', '#', :data => {:link => jcrop_path(:model_name => form.object.class.to_param, :modal => true, :id => form.object.id, :field => field.name, :fit_image => field.fit_image), :thumb => field.thumb_method}, :style => 'display:none', :class => "jcrop_handle"
- if field.optional? && field.errors.blank? && file && field.delete_method
  %a.btn.btn-info{:href => '#', :'data-toggle' => 'button', :onclick => "$(this).siblings('[type=checkbox]').click(); $(this).siblings('.toggle').toggle('slow'); jQuery(this).toggleClass('btn-danger btn-info'); return false"}
    %i.icon-white.icon-trash
    = I18n.t('admin.actions.delete.menu').capitalize + " #{field.method_name}"
  = form.check_box(field.delete_method, :style => 'display:none;' )
- if field.cache_method
  = form.hidden_field(field.cache_method)
